<template>
    <div class="gallary" @click="handlegallaryclick">
      <div class="wraper">
        <swiper :options="swiperOption" >
          <swiper-slide v-for="(item,index) in imgs" :key="index">
            <img class="swiper-img" :src="item" >
          </swiper-slide>
          <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>
      </div>
    </div>
</template>

<script>
export default {
  name: 'gallary',
  props: {
    imgs: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        // 进入自我刷新，解决宽度计算问题
        observeParents: true,
        observer: true
      }
    }
  },
  methods: {
    handlegallaryclick () {
      this.$emit('colsegallary')
    }
  }
}
</script>

<style scoped>
  .gallary >>> .swiper-container{overflow: inherit}
  .gallary{
    z-index: 1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: #000;
    display: flex;
    align-items: center;
  }
  .wraper{
    width: 100%;
  }
  .swiper-img{
    width: 100%;
  }
  .swiper-pagination{
    bottom: -50px;
    color: white;
  }
</style>
